import 'package:fate_blind_box/theme/theme_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ActPubLishSwitchItemView extends StatefulWidget {
  String leftName = '';
  bool isHiddenLine = false;
  bool isChose = false;
  Function? switchAction;

  ActPubLishSwitchItemView(
      {this.leftName = '',
      this.isHiddenLine = false,
      this.isChose = false,
      this.switchAction,
      Key? key})
      : super(key: key);

  @override
  State<ActPubLishSwitchItemView> createState() =>
      _ActPubLishSwitchItemViewState();
}

class _ActPubLishSwitchItemViewState extends State<ActPubLishSwitchItemView> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 14.w, right: 14.w, top: 5.w, bottom: 13.w),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                widget.leftName,
                style:
                    TextStyle(color: ThemeColor.black1414Color, fontSize: 16),
              ),
              Switch(
                  value: widget.isChose,
                  onChanged: (res) {
                    if(widget.switchAction!=null){
                      widget.switchAction!();
                    }
                  }),
            ],
          ),
          Offstage(
            offstage: widget.isHiddenLine,
            child: Container(
              height: 0.5,
              color: ThemeColor.lineColor,
            ),
          ),
        ],
      ),
    );
  }
}
